package com.ruoyi.system.dingutil;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.StringUtils;

public class YidaUtil {
    public static String queryform="https://api.dingtalk.com/v1.0/yida/forms/instances/search";
    public static String queryformadv="https://api.dingtalk.com/v1.0/yida/forms/instances/advances/queryAll";
    public static String saveform="https://api.dingtalk.com/v1.0/yida/forms/instances";

    public static JSONObject queryForm(String accesstoken,String data){
        String ret = NetUtils.postBodyyd(queryform,data,accesstoken);
        JSONObject jb = null;
        if(!StringUtils.isEmpty(ret)){
            jb = JSON.parseObject(ret);
        }
        return jb;
    }
    public static JSONObject queryFormAdv(String accesstoken,String data){
        String ret = NetUtils.postBodyyd(queryformadv,data,accesstoken);
        JSONObject jb = null;
        if(!StringUtils.isEmpty(ret)){
            jb = JSON.parseObject(ret);
        }
        return jb;
    }
    public static JSONObject saveForm(String accesstoken,String data){
        String ret = NetUtils.postBodyyd(saveform,data,accesstoken);
        JSONObject jb = null;
        if(!StringUtils.isEmpty(ret)){
            jb = JSON.parseObject(ret);
        }
        return jb;
    }
}
